public class Student {
    private String studentId;   // 学生编号
    private String name;        // 学生姓名
    private String gender;      // 学生性别
    private Course selectedCourse; // 所选课程

    // 构造方法
    public Student(String studentId, String name, String gender) {
        this.studentId = studentId;
        this.name = name;
        this.gender = gender;
    }

    // 学生“选课”方法
    public void selectCourse(Course course) {
        this.selectedCourse = course;
        System.out.println(name + " 学生成功选修 " + course.getCourseName() + " 课程");
    }

    // 学生“退课”方法
    public void dropCourse() {
        if (selectedCourse != null) {
            System.out.println(name + " 学生成功退选 " + selectedCourse.getCourseName() + " 课程");
            selectedCourse = null;
        } else {
            System.out.println(name + " 学生当前未选任何课程，无需退课");
        }
    }

    // 打印学生课表
    public void printCourseSchedule() {
        System.out.println("=== " + name + " 的课表 ===");
        if (selectedCourse != null) {
            System.out.println("学生编号: " + studentId);
            System.out.println("课程名称: " + selectedCourse.getCourseName());
            System.out.println("上课地点: " + selectedCourse.getLocation());
            System.out.println("上课时间: " + selectedCourse.getTime());
            System.out.println("授课教师: " + selectedCourse.getTeacher().getName());
        } else {
            System.out.println("当前未选任何课程");
        }
        System.out.println("================");
    }

    // Getter 和 Setter 方法
    public String getStudentId() { return studentId; }
    public void setStudentId(String studentId) { this.studentId = studentId; }
    public String getName() { return name; }
    public void setName(String name) { this.name = name; }
    public String getGender() { return gender; }
    public void setGender(String gender) { this.gender = gender; }
    public Course getSelectedCourse() { return selectedCourse; }
    public void setSelectedCourse(Course selectedCourse) { this.selectedCourse = selectedCourse; }
}